-- elect
-- created by zhuangsl
-- 静电场

return {
    fetchProps = function(who, status, condition)
        local props  = {};
        local propId = PropM.getPropId("attrib_elect");
        local value  = tonumber(condition["value"]);
        local endRound = condition["end_round"];

        if value > 0 then
            table.insert(props, { propId, "magic", value, endRound, });
        end
        
        -- 攻击同时提高
        local attack  = tonumber(condition["attack"]);
        if attack > 0 then
            table.insert(props, { propId, "attack", value, endRound, });
        end

        return props;
    end,

    fireEvent = function(target, status, condition, para)
        if para and para == "clear" then
            EventMgr.fire(event.NEED_REFRESH_ATTRIB, {});
        end
    end,

    desc = function(who, status, condition)
        -- 获取状态描述
        local cfg = CombatStatusM.getStatusInfo(status);
        local desc = cfg.desc;

        -- 天赋额外效果
        local attack  = tonumber(condition["attack"]);
        if attack > 0 then
            desc = cfg.extra_desc;
            desc = string.gsub(desc, "{append}", attack);
        end

        -- 效果
        local value = condition["value"];
        desc = string.gsub(desc, "{value}", value);

        return desc;
    end,
};
